import QtQuick 1.1
import com.nokia.symbian 1.1

Page{
    id: root

    property alias saveName: filenameField.text
    signal saveToFile(string filename);

    Rectangle{
        id: mainRect
        anchors.fill: parent
        color: "transparent"

        Column{
            anchors.left: parent.left
            anchors.right: parent.right

            spacing: 7
            Text{
                anchors.horizontalCenter: parent.horizontalCenter
                color: "white"
                wrapMode: Text.WordWrap
                text: qsTr("Set filename for image.")
                font.bold: true
            }

            TextField{
                id: filenameField
                text:  "example.jpg"
                anchors.right: parent.right
                anchors.rightMargin: 0
                anchors.left: parent.left
                anchors.leftMargin: 0
                anchors.margins: 2

                Image{
                    anchors{
                        top: parent.top
                        right: parent.right
                        margins: 2
                    }
                    visible: filenameField.text
                    height: parent.height
                    width: parent.height

                    MouseArea{
                        anchors.fill: parent
                        onClicked: {
                            filenameField.text = ""
                            filenameField.forceActiveFocus()
                        }
                    }
                }
            }

            Button{
                id: createButton
                width: parent.width
                height: font.pixelSize*2
                text: qsTr("Create image")
                onClicked: {
                    root.saveToFile(filenameField.text)
                    pageStack.pop();
                }
            }

        }
    }
}

